import { defineStore } from "pinia";
import { ref } from "vue";
const useStore = defineStore(
	"szgbMobile",
	() => {
		const user = ref({});
		const dict = ref({});
		const offlineMode = ref(false);
		const option = ref({});
		const setUser = (value) => {
			user.value = value;
		};
		const setDict = (value) => {
			dict.value = value;
		};
		const setOfflineMode = (value) => {
			offlineMode.value = value;
		};
		const setOption = (key, value) => {
			option.value[key] = value;
		};
		const clearAll = () => {
			user.value = {};
			dict.value = {};
			offlineMode.value = false;
			option.value = {};
		};
		return {
			user,
			dict,
			offlineMode,
			option,
			setUser,
			setDict,
			setOfflineMode,
			setOption,
			clearAll,
		};
	},
	{
		persist: {
			enabled: true,
		},
	}
);
export default useStore;
